package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.system.domain.Lesson;
import com.ruoyi.system.mapper.LessonMapper;
import com.ruoyi.system.service.ILessonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-03-29
 */
@Service
public class LessonServiceImpl implements ILessonService
{
    @Autowired
    private LessonMapper lessonMapper;

    /**
     * 查询课程
     * 
     * @param lessonId 课程主键
     * @return 课程
     */
    @Override
    public Lesson selectLessonByLessonId(Long lessonId)
    {
        return lessonMapper.selectLessonByLessonId(lessonId);
    }

    /**
     * 查询课程列表
     * 
     * @param lesson 课程
     * @return 课程
     */
    @Override
    public List<Lesson> selectLessonList(Lesson lesson)
    {
        return lessonMapper.selectLessonList(lesson);
    }

    /**
     * 新增课程
     * 
     * @param lesson 课程
     * @return 结果
     */
    @Override
    public int insertLesson(Lesson lesson)
    {
        return lessonMapper.insertLesson(lesson);
    }

    /**
     * 修改课程
     * 
     * @param lesson 课程
     * @return 结果
     */
    @Override
    public int updateLesson(Lesson lesson)
    {
        return lessonMapper.updateLesson(lesson);
    }

    /**
     * 批量删除课程
     * 
     * @param lessonIds 需要删除的课程主键
     * @return 结果
     */
    @Override
    public int deleteLessonByLessonIds(String lessonIds)
    {
        return lessonMapper.deleteLessonByLessonIds(Convert.toStrArray(lessonIds));
    }

    /**
     * 删除课程信息
     * 
     * @param lessonId 课程主键
     * @return 结果
     */
    @Override
    public int deleteLessonByLessonId(Long lessonId)
    {
        return lessonMapper.deleteLessonByLessonId(lessonId);
    }
}
